/**
 * Created by Administrator on 2017/8/4.
 */


import React,{Component} from 'react'
import {FlatList,Image,Text,View,StyleSheet,Dimensions} from 'react-native'
import NetUtils from '../Common/NetUtils'
import RequestUrl from '../Common/Constant'
const ScreenSize = {
    width: Dimensions.get('window').width,
    height: Dimensions.get('window').height
};
const styles = StyleSheet.create({
    ll:{
        width:ScreenSize.width,
        height:148,
        backgroundColor:'#fff'
    },
    topLl:{
        width:ScreenSize.width,
        height:36,
        flexDirection:'row',
        justifyContent:'space-between',
        alignItems:'center'
    },
    bottomLl:{
        width:ScreenSize.width,
        height:111,
        justifyContent:'center'
    },
    bottomContentLl:{
        width:ScreenSize.width,
        height:88,
        flexDirection:'row',
        alignItems:'center'
    },
    bottomRightLl:{
        height:88,
        flex:1,
        justifyContent:'space-between',
        marginLeft:16
    },
    imgll:{
        width:117,height:88,marginLeft:12
    },
    tv1:{
        fontSize:14,color:'#333'
    },
    tv2:{
        fontSize:14,color:'#999'
    },
    tv3:{
        fontSize:14,color:'#FC3B38'
    }
})
let ItemImg = require('../Img/icon.png')
export default class UserMenu extends Component{

    constructor(props) {
        super(props)
        this.state = {
            dataList: [{}, {}, {}]

        }
    }

    render()
    {
        return (
            <FlatList
                ItemSeparatorComponent={()=>this._renderDivider()}
                data={this.state.dataList}
                renderItem={({item}) =>this._renderItem()}/>
        )
    }

    _renderDivider(){
        return(
            <View style={{backgroundColor:'#ededed',height:8}}></View>
        )
    }

    _renderItem(item){
        return(
            <View style={styles.ll}>
                <View style={styles.topLl}>
                    <Text style={[styles.tv1,{marginLeft:13}]}>柜号：14100</Text>
                    <Text style={[styles.tv2,{marginRight:13, color:'#4EB48E'}]}>补货成功</Text>
                </View>
                <View style={{height:0.5,flex:1,marginLeft:13,marginRight:13,backgroundColor:'#cfcfcf'}}></View>
                <View style={styles.bottomLl}>
                    <View style={styles.bottomContentLl}>
                        <Image style={styles.imgll} source={ItemImg}/>
                        <View style={styles.bottomRightLl}>

                            <View style={[styles.topLl,{height:16,width:ScreenSize.width-145}]}>
                                <Text style={[styles.tv1,{fontSize:17}]}>纸巾</Text>
                                <Text style={[styles.tv2,{marginRight:12}]}>x5</Text>
                            </View>
                            <Text style={styles.tv2}>2017-07-05 15:25:36</Text>
                            <Text style={styles.tv1}>地址：金牛区万达广场2楼</Text>
                        </View>
                    </View>
                </View>
            </View>
        )
    }

    componentDidMount() {
        this._fetchData()
    }

    _fetchData(){
        let params = {page:1}
        NetUtils.getData(RequestUrl.URL_USER_MENU,params,(result) =>{
            console.log('request result:'+result)
        })
    }
}